#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

void contract(int* p,int num)
{
	int i = 0;
	int* left = p;
	int* right = p + num - 1;
	int t=0;
	while ((left+i) < (right-i))
	{
		t = *(left+i);
		*(left+i) = *(right-i);
		*(right-i) = t;
		i++;
	}
}
int main()
{
	int a[] = { 0 };
	int count = 0;
	scanf("%d", &count);
	for (int i = 0; i < count; i++)
		scanf("%d", &a[i]);
	for (int i = 0; i < count; i++)
		printf("%d ", a[i]);
	contract(a,count);
	printf("\n");
	for (int i = 0; i < count; i++)
		printf("%d ", a[i]);
	return 0;
}